EEL_MODS	+= toolchain

# $(info $(call def-pkg,TC32,BARE))
$(eval $(call def-pkg,TC32,BARE))
$(eval $(call def-pkg,TC64,BARE))

ifneq ($(TC32_BASE_BARE),$(TC32_BASE_OS))
$(eval $(call def-pkg,TC32,OS))
endif
ifneq ($(TC64_BASE_BARE),$(TC64_BASE_OS))
$(eval $(call def-pkg,TC64,OS))
endif

PHONY-toolchain += toolchain-download
toolchain-download:
	$(call download-file,$(TC_URL),$(EEL_DL_DIR)/$(TC_PKG)) \
		&& touch $(EEL_DL_DIR)/.dl_done.$(TC_PKG)

# FIXME: not work: $(call dec-tar,$(EEL_DL_DIR)/$(TC_PKG),$(EEL_TC_DIR))
PHONY-toolchain += toolchain-dec
toolchain-dec: $(EEL_DL_DIR)/.dl_done.$(TC_PKG)
	$(EELQ5)mkdir -p $(EEL_TC_DIR)
	$(EELQ5)\rm -f $(TC_PATH_DONE)
ifneq ($(findstring .tar.xz,$(TC_PKG)),)
	$(call dec-tar-xz,$(EEL_DL_DIR)/$(TC_PKG),$(EEL_TC_DIR))
endif
ifneq ($(findstring .tar.bz2,$(TC_PKG)),)
	$(call dec-tar-bz2,$(EEL_DL_DIR)/$(TC_PKG),$(EEL_TC_DIR))
endif
ifneq ($(findstring .tar.gz,$(TC_PKG)),)
	$(call dec-tar-gz,$(EEL_DL_DIR)/$(TC_PKG),$(EEL_TC_DIR))
endif
	$(EELQ4)touch -m $(TC_PATH)
	$(EELQ4)touch $(TC_PATH_DONE)

PHONY-toolchain += toolchain-info
toolchain-info: $(TC_PATH)
	$(EELQ5)echo $(TC_PREFIX)
